package com.game.thrones.domain.IdEntity;

import java.util.Date;

import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;

/**
 * 继承IdEntityAuto的对象，在创建或更新前自动加入时间戳
 * 
 * @author sunyang
 *
 */
public class IdEntityAssignedListener {

	@PrePersist
	public void prePersist(IdEntityAssigned idEntityAssigned) {
		Date now = new Date();
		idEntityAssigned.setCreateTime(now);
		idEntityAssigned.setModifyTime(now);
	}

	@PreUpdate
	public void preUpdate(IdEntityAssigned idEntityAssigned) {
		Date now = new Date();
		idEntityAssigned.setModifyTime(now);
	}

}
